package com.portal.gui.marketman;

import java.awt.Container;
import java.awt.EventQueue;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;

public class MarketingManPortal extends JFrame {

	private JPanel contentPane;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					MarketingManPortal frame = new MarketingManPortal();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public MarketingManPortal() {
		setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
		setTitle("Marketing Man Scr");
		setBounds(100, 100, 450, 300);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JLabel lblManageField = new JLabel("Manage Field");
		lblManageField.setBounds(28, 15, 86, 16);
		contentPane.add(lblManageField);
		
		JLabel lblManageType = new JLabel("Manage Type");
		lblManageType.setBounds(163, 15, 97, 16);
		contentPane.add(lblManageType);
		
		JLabel lblManageProduct = new JLabel("Manage Product");
		lblManageProduct.setBounds(302, 15, 97, 16);
		contentPane.add(lblManageProduct);
		
		JButton btnAddField = new JButton("Add Field");
		btnAddField.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent actionevent) {
				AddFieldScr addFieldScrFrame = new AddFieldScr();
				addFieldScrFrame.setVisible(true);
			}
		});
		btnAddField.setBounds(12, 41, 97, 25);
		contentPane.add(btnAddField);
		
		JButton btnEditField = new JButton("Edit Field");
		btnEditField.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent actionevent) {
				EditFieldScr editFieldScr = new EditFieldScr();
				editFieldScr.setVisible(true);
			}
		});
		btnEditField.setBounds(12, 79, 97, 25);
		contentPane.add(btnEditField);
		
		JButton btnAddType = new JButton("Add Type");
		btnAddType.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent actionevent) {
				AddTypeScr addTypeScr = new AddTypeScr();
				addTypeScr.setVisible(true);
			}
		});
		btnAddType.setBounds(163, 44, 97, 25);
		contentPane.add(btnAddType);
		
		JButton btnEditType = new JButton("Edit Type");
		btnEditType.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent actionevent) {
				EditTypeScr editTypeScr = new EditTypeScr();
				editTypeScr.setVisible(true);
			}
		});
		btnEditType.setBounds(163, 82, 97, 25);
		contentPane.add(btnEditType);
		
		JButton btnAddProduct = new JButton("Add Product");
		btnAddProduct.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent actionevent) {
				AddProductScr addProductScr = new AddProductScr();
				addProductScr.setVisible(true);
			}
		});
		btnAddProduct.setBounds(302, 44, 107, 25);
		contentPane.add(btnAddProduct);
		
		JButton btnEditProduct = new JButton("Edit Product");
		btnEditProduct.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent actionevent) {
				SelectProductToEditScr selectProductToEditScr = new SelectProductToEditScr();
				selectProductToEditScr.setVisible(true);
			}
		});
		btnEditProduct.setBounds(302, 79, 107, 25);
		contentPane.add(btnEditProduct);
		
		final JButton btnExit = new JButton("Exit");
		btnExit.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent actionevent) {
				Container frame = btnExit.getParent();
	            do{
	                frame = frame.getParent(); 
	            }while (!(frame instanceof JFrame));                                      
	            ((JFrame) frame).dispose();
	            
			}
		});
		
		btnExit.setBounds(17, 196, 97, 25);
		contentPane.add(btnExit);
		
		JButton btnAddCustomer = new JButton("Add Customer");
		btnAddCustomer.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent actionevent) {
				AddCustomerScr addCustomerScr = new AddCustomerScr();
				addCustomerScr.setVisible(true);
			}
		});
		btnAddCustomer.setBounds(302, 165, 97, 25);
		contentPane.add(btnAddCustomer);
		
		JButton btnEditCustomer = new JButton("Edit Customer");
		btnEditCustomer.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
				SelectCustomerToEditScr selectCustomerToEditScr = new SelectCustomerToEditScr();
				selectCustomerToEditScr.setVisible(true);
			}
		});
		btnEditCustomer.setBounds(302, 196, 97, 25);
		contentPane.add(btnEditCustomer);
		
		JLabel lblManageCustomers = new JLabel("Manage Customers");
		lblManageCustomers.setBounds(302, 147, 89, 16);
		contentPane.add(lblManageCustomers);
	}
}
